<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>用户头像</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{/css/global.css}">
</head>
<body>

<div th:include="common/header::header"></div>

<div class="main fly-user-main layui-clear">
    <ul class="layui-nav layui-nav-tree layui-inline" lay-filter="user">
        <li class="layui-nav-item ">
            <a th:href="@{/user/set}">
                <i class="layui-icon">&#xe620;</i>
                基本设置
            </a>
        </li>
        <li class="layui-nav-item layui-this">
            <a th:href="@{/user/seticon}">
                <i class="layui-icon">&#xe620;</i>
                头像设置
            </a>
        </li>
        <li class="layui-nav-item">
            <a th:href="@{/user/setpsw}">
                <i class="layui-icon">&#xe620;</i>
                密码设置
            </a>
        </li>
        <li class="layui-nav-item">
            <a href="message.html">
                <i class="layui-icon">&#xe611;</i>
                我的消息
            </a>
        </li>
    </ul>
    <div class="fly-panel fly-panel-user" pad20>
        <div class="layui-tab-content" style="padding: 20px 0;">
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="updateico">上传图片</button>
                <div class="layui-upload-list">
                    <img class="layui-upload-img" id="img">
                    <p id="demoText"></p>
                </div>
            </div>
        </div>
    </div>
</div>




<div th:include="common/footer::footer"></div>

<script>
    layui.use('upload', function(){
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#updateico' //绑定元素
            ,url: quark_upload_icon_api+getCookie() //上传接口
            ,done: function(res){
                //上传完毕回调
                $("#img").attr('src',res.data.src);
                layer.msg("修改成功", {
                    icon: 1,
                    time: 1000 //1秒关闭
                }, function(){
                    location.href = "/index";
                });
            }
            ,error: function(){
                layer.msg("出现异常", {icon: 5});
            }
        });
    });
</script>

</body>
</html>